﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace XmlDSigEx
{
    class Manifest:IManifest
    {
        private List<Reference> _references = new List<Reference>();       

        internal void Write(XmlWriter writer)
        {
            writer.WriteStartElement("Manifest", XmlSigner.NS_XMLDSIG);
            if (ID != null)
                writer.WriteAttributeString("Id", ID);

            foreach (Reference reference in _references)
            {
                reference.WriteXml(writer);
            }

            writer.WriteEndElement();
        }

        public Reference CreateReference()
        {
            Reference reference = new Reference();
            reference.Precomputed = true;
            _references.Add(reference);
            return reference;
        }

        public string ID
        {
            get;
            set;
        }
    }
}
